package com.hnevc.androidui7;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class Activity02 extends AppCompatActivity {

    Button mBtn2;//保存获取到的按钮对象
    EditText mEtAmount;//保存获取到的文本标签对象
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_02);

        mBtn2 = findViewById(R.id.btn_button2);
        mEtAmount = findViewById(R.id.et_amount);

        mBtn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String amout = mEtAmount.getText().toString();//获取
                Intent intent = new Intent();
                intent.putExtra("data",amout); //创建intent，包装数据，用于回传
                setResult(1002,intent);//将intent回传
                finish();//关闭当前activity
            }
        });


    }

}
